package org.se.scut.pinterest.mina.handler.observer;

import java.util.HashMap;

import org.apache.mina.core.session.IoSession;
import org.se.scut.pinterest.mina.codec.msg.Message;

public abstract class MessageContainer{
	
	protected  final HashMap<Integer, IMessageObserver> mObservers;
	
	public MessageContainer() {
		mObservers = new HashMap<Integer, IMessageObserver>();
	}
	
	public void registe(Integer hashCode, IMessageObserver observer){
		synchronized (mObservers) {
			mObservers.put(hashCode, observer);
		}
	}
	
	public void unregiste(IMessageObserver observer){
		synchronized (mObservers) {
			mObservers.remove(observer);
		}
	}
	
	public abstract void callObserver(IoSession session, Message msg , MessageOperatorType type);
	
	
	
}
